import { createRouter, createWebHistory } from "vue-router";
//引入前端页面路劲
import Home from '../components/home/Home.vue'
	import Main from '../components/home/page/Main.vue'
	import DetaList from '../components/home/page/DetaList.vue'
	import Cart from '../components/home/page/Cart.vue'

//引入后台路径
import Admin from '../components/admin/Admin.vue'
	import Type from '../components/admin/page/Type.vue'
	import Books from '../components/admin/page/Books.vue'
	import Banner from '../components/admin/page/Banner.vue'


const routes = [
	{
		path:'/',
		name:'Home',
		component:Home,
		children:[
			{path:'/',redirect:'main'},
			{path:'/main',name:'main',component:Main},
			{path:'/detaList',name:'detaList',component:DetaList},
			{path:'/cart',name:'cart',component:Cart}
		]
	},
	{
		path:'/admin',
		name:'Admin',
		component:Admin,
		children:[
			{path:'/admin/type',name:'type',component:Type},
			{path:'/admin/books',name:'books',component:Books},
			{path:'/admin/banner',name:'banner',component:Banner}
		]
	}
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
